package src.edu.wayne.cs.csc4110.hw6.plugins;

import java.util.HashSet;

import src.edu.wayne.cs.csc4110.hw6.implementations.FrameWorkImpl;
import src.edu.wayne.cs.csc4110.hw6.implementations.stateMachine.StateMachine;
import src.edu.wayne.cs.csc4110.hw6.interfaces.FrameWork;
import src.edu.wayne.cs.csc4110.hw6.interfaces.User;
import src.edu.wayne.cs.csc4110.hw6.tests.DatabaseTests;


public class Main {
	public static void main(String[] args) throws Exception {
		
		//This code makes a dbase using the JUnit test code.
		DatabaseTests dbaseFactory = new DatabaseTests();
		dbaseFactory.setUp(); 
		
		//This code should stay in the final version.
		FrameWork myFramework = FrameWorkImpl.getFrameWork();
		myFramework.setDataBase(dbaseFactory.getDataBase());
		HashSet<User> usersInSession = new HashSet<User>();
		
		User tempUser = myFramework.getDataBase().getUser("cr3550");
		
		usersInSession.add(myFramework.getDataBase().getUser("cr3550"));
		usersInSession.add(myFramework.getDataBase().getUser("user2@wayne.edu"));
		usersInSession.add(myFramework.getDataBase().getUser("user1@wayne.edu"));
		
		
		myFramework.setUsersInSession(usersInSession);
		
		( (FrameWorkImpl) myFramework).setCurrentUser(myFramework.getDataBase().getUser("user1"));
		
		StateMachine stateMachine = ( (FrameWorkImpl) myFramework).getStateMachine();
		stateMachine.setCurrentuser(myFramework.getDataBase().getUser("user1@wayne.edu"));
		stateMachine.setState(stateMachine.getLoggedInState());
		
		
		
		
		myFramework.startFrameWork();
		
		System.out.printf("all done \n");
	}
}
